/* @(#)GSManufactureQueryAction.java    V0.1
 *
 * Project: GSdevelop
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   owen         2006-3-22
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
 *        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
 *        Haidian District, Beijing ,100081, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with HiTRUST.
 *
 * Warning:
 * =============================================================================
 * 
 */
package com.hitrust.gs.action;

import java.util.ArrayList;

import system.LoginContext;
import system.base.ProductTypeManager;

import com.hitrust.gs.business.GSManufactureProcessor;
import com.hitrust.gs.business.GSUniteGwProcessor;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.lib.GSLogWriter;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;

import framework.core.DBConnection;
import framework.core.ObjectList;

/**
 * 产品管理查询界面
 */
public class GSManufactureQueryAction extends GSBaseAction{

    public String execute(GSBaseForm aForm) throws Exception {
        
        //种类等级
        GSManufactureProcessor tGSManufProcessor = new GSManufactureProcessor();
        tGSManufProcessor.getManufactureOfLevel(aForm);
        DBConnection con =null;
        try {
        	 con = DBConnection.open();
             ObjectList productTypeManager1 = ProductTypeManager.getUpperProductType(con);
             ObjectList productTypeManager2 = ProductTypeManager.getProductType(con);
             
             aForm.getRequest().setAttribute("productTypeManager1",productTypeManager1);
             
             aForm.getRequest().setAttribute("productTypeManager2",productTypeManager2);
		} catch (Exception e) {
			GSLogWriter.error("产品结算分类异常",e);
		}finally{
			if(con!=null){
				con.close();
			}
		}
       
        //仓库
        GSUniteGwProcessor unitePro=new GSUniteGwProcessor();
        LoginContext context=(LoginContext) aForm.getSession().getAttribute(GSBaseConstants.LOGIN);
        ArrayList wareHouse= unitePro.getWareHouseLevelName(context.getWarehouse().getCode(),context.getWarehouse().getCode());
      //增加配置文件 判断湖南巴士计划价
        if(GSBaseConstants.PLANPRICE.equals("true")){
            aForm.getRequest().setAttribute("isPlanprice", "1");
        }else{
            aForm.getRequest().setAttribute("isPlanprice", "0");
        }
        aForm.getRequest().setAttribute("wareHouse", wareHouse);
        return GSBaseConstants.FORWARD_SUCCESS;
    }
}
